Skip to content

初始化OLA数据库 - InitOlaDatabase

函数简介

初始化OLA数据库,执行创建表、初始化默认数据等必要操作。

接口名称

InitOlaDatabase

DLL调用

cpp
int InitOlaDatabase(long ola, const long db);

参数说明

参数名类型说明
ola长整型数OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成
db长整型数数据库连接句柄,由 OpenDatabase 接口生成

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int ret = ola.InitOlaDatabase(0);
csharp
using OLAPlug;

var ola = new OLAPlugServer();
int ret = ola.InitOlaDatabase(0);
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ret = ola.InitOlaDatabase(0)
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
int ret = ola.InitOlaDatabase(0);
cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.InitOlaDatabase(0)
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.InitOlaDatabase(0)
text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.InitOlaDatabase(0)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.InitOlaDatabase(0);
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.InitOlaDatabase(0)
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int32_t ret = ola.InitOlaDatabase(0);

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
InitOlaDatabase(instance, 0);
csharp
using System.Runtime.InteropServices;
using System.Text;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int InitOlaDatabase(long ola, long db);

long instance = CreateCOLAPlugInterFace();
InitOlaDatabase(instance, 0);
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.InitOlaDatabase(instance, 0)

返回值

操作结果。成功返回 1,失败返回 0

注意事项

  • 确保在数据库打开后调用此函数,否则可能导致未定义行为。
  • 如果初始化失败,可通过 GetDatabaseError 获取详细错误信息。